void ShortestDist( LGraph Graph, int dist[], Vertex S )
{
    for(int i = 0; i < Graph->Nv; ++i)
        dist[i] = -1;
    dist[S] = 0;
    int Q[Graph->Nv];
    int first = 0, rear = 0;
    Q[rear++] = S;
    PtrToAdjVNode current;
    int Qhead;
    int level = 1;
    
    int level_end = 0;
    
    while(first < rear)
    {
        Qhead = Q[first++];
        current = Graph->G[Qhead].FirstEdge;
        while(current != NULL)
        {
	    
            if(dist[current->AdjV] == -1)
            {
                Q[rear++] = current->AdjV;
                
                dist[current->AdjV] = level;
            }
            current = current->Next;
        }
        if(first - 1 == level_end)
        {
            level_end = rear - 1;
            ++level;
        }
    }
}